<template>
	<view class="container">
		<view class="form-section">
			<!-- 设备信息 -->
			<view class="form-group">
				<view class="form-title">设备信息</view>
				<view class="form-item">
					<text class="label">设备名称</text>
					<text class="value">{{ deviceInfo.sbmc || '-' }}</text>
				</view>
				<view class="form-item">
					<text class="label">设备编号</text>
					<text class="value">{{ deviceInfo.sbbh || '-' }}</text>
				</view>
				<view class="form-item">
					<text class="label">安装地点</text>
					<text class="value">{{ deviceInfo.azdd || '-' }}</text>
				</view>
				<view class="form-item">
					<text class="label">状态</text>
					<text class="value">{{ deviceInfo.zt.zt_ztmc || '-' }}</text>
				</view>
				<view class="form-item">
					<text class="label">厂区</text>
					<text class="value">{{ deviceInfo.shop_id.shop_id_ShopName || '-' }}</text>
				</view>
				<view class="form-item">
					<text class="label">型号</text>
					<text class="value">{{ deviceInfo.xh || '-' }}</text>
				</view>
				<view class="form-item">
					<text class="label">规格</text>
					<text class="value">{{ deviceInfo.ggxh || '-' }}</text>
				</view>
				<view class="form-item">
					<text class="label">生产厂家</text>
					<text class="value">{{ deviceInfo.sccj || '-' }}</text>
				</view>
				<view class="form-item">
					<text class="label">出厂日期</text>
					<text class="value">{{ deviceInfo.ccrq || '-' }}</text>
				</view>
				<view class="form-item">
					<text class="label">入账日期</text>
					<text class="value">{{ deviceInfo.rzrq || '-' }}</text>
				</view>
				<view class="form-item">
					<text class="label">类别名称</text>
					<text class="value">{{ deviceInfo.sblb_id.sblb_id_lbmc || '-' }}</text>
				</view>
				<view class="form-item">
					<text class="label">部门名称</text>
					<text class="value">{{ deviceInfo.bmbh_id.bmbh_id_name || '-' }}</text>
				</view>
				<view class="form-item">
					<text class="label">备注</text>
					<text class="value">{{ deviceInfo.bz || '-' }}</text>
				</view>
				<view class="form-item">
					<text class="label">创建时间</text>
					<text class="value">{{ deviceInfo.createtime || '-' }}</text>
				</view>
			</view>
			<view class="form-group">
				<view class="form-title">历史记录</view>
				<view class="isQualified">
					<text class="label">点检</text>
					<u-icon name="/static/images/jump.png" :size="16" @tap="inspectionHistory" />
				</view>

				<view class="isQualified">
					<text class="label">保养</text>
					<u-icon name="/static/images/jump.png" :size="16" @tap="maintenanceHistory" />
				</view>
				<view class="isQualified">
					<text class="label">润滑</text>
					<u-icon name="/static/images/jump.png" :size="16" @tap="lubricationHistory" />
				</view>
				<view class="isQualified">
					<text class="label">维修</text>
					<u-icon name="/static/images/jump.png" :size="16" @tap="repairHistory" />
				</view>
				<view class="isQualified">
					<text class="label">故障</text>
					<u-icon name="/static/images/jump.png" :size="16" @tap="failureHistory" />
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				deviceId: '',
				deviceInfo: {
					abc: {
						abc: "",
						abc_lxmc: "",
						abc_lxbh: ""
					},
					azdd: "",
					bfrq: null,
					bmbh_id: {
						bmbh_id: "",
						bmbh_id_code: "",
						bmbh_id_name: ""
					},
					bz: null,
					ccbh: null,
					ccrq: null,
					cyjs: null,
					del: false,
					ggxh: "",
					id: "",
					isTzsb: false,
					jsgg: null,
					position: null,
					re: false,
					ry: false,
					rzrq: "",
					sbbh: "",
					sbbh_old: "",
					sblb_id: {
						sblb_id: "",
						sblb_id_ID: "",
						sblb_id_lbmc: "",
						sblb_id_lbbh: ""
					},
					sbmc: "",
					sbsS_SBTZ_CHANGELOGs: [],
					sbsl: null,
					sbss_sbtz_fssbs: [],
					sbss_sbtz_gzfys: [],
					sbzl: null,
					sccj: "",
					shop_id: {
						shop_id: "",
						shop_id_ShopName: "",
						shop_id_ShopCode: ""
					},
					sl: 0,
					syrq: "",
					tzsbSd: true,
					updateTime: {
						lastChangedById: "",
						createdById: "",
						createdOn: "",
						createdBy: "",
						lastChangedBy: "",
					},
					version: "",
					xh: "",
					zjly: "",
					zt: {
						zt: "",
						zt_ztmc: "",
						zt_ztbh: "",
						zt_ID: ""
					},

				},
			};
		},
		onLoad(options) {
			const item = JSON.parse(decodeURIComponent(options.item));
			this.deviceId = item.id
			this.deviceInfo = item
		},
		methods: {
			inspectionHistory() {
				const deviceId = this.deviceInfo.id;
				uni.navigateTo({
					url: `/pageTwo/pages/record/inspection?deviceId=${deviceId}`
				});
			},

			maintenanceHistory() {
				const deviceId = this.deviceInfo.id;
				uni.navigateTo({
					url: `/pageTwo/pages/record/maintenance?deviceId=${deviceId}`
				});
			},

			lubricationHistory() {
				const deviceId = this.deviceInfo.id;
				uni.navigateTo({
					url: `/pageTwo/pages/record/lubrication?deviceId=${deviceId}`
				});
			},

			repairHistory() {
				const deviceId = this.deviceInfo.id;
				uni.navigateTo({
					url: `/pageTwo/pages/record/repair?deviceId=${deviceId}`
				});
			},

			failureHistory() {
				const deviceId = this.deviceInfo.id;
				uni.navigateTo({
					url: `/pageTwo/pages/record/failure?deviceId=${deviceId}`
				});
			},

		}
	};
</script>
<style scoped>
	.form-section {
		padding: 20rpx;
	}

	.form-group {
		background: #ffffff;
		border-radius: 12rpx;
		padding: 24rpx;
		margin-bottom: 20rpx;
	}

	.form-title {
		font-size: 28rpx;
		font-weight: 500;
		color: #333;
		margin-bottom: 20rpx;
		border-left: 4rpx solid #1890ff;
		padding-left: 12rpx;
	}

	.form-item {
		display: flex;
		align-items: center;
		padding: 16rpx 0;
		border-bottom: 1rpx solid #f0f0f0;
	}

	.label {
		min-width: 160rpx;
		color: #666;
		font-size: 26rpx;
	}

	.value {
		flex: 1;
		color: #333;
		font-size: 26rpx;
	}


	.isQualified {
		flex: 1;
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 16rpx 0;
		border-bottom: 1rpx solid #f0f0f0;
	}
</style>